<%@page import="me.yobol.greentable.service.DishesService"%>
<%@page import="me.yobol.greentable.bean.DishesBean"%>
<%@page import="me.yobol.greentable.service.UserService"%>
<%@page import="me.yobol.greentable.bean.IngredientBean"%>
<%@ page import="me.yobol.greentable.service.IngredientService"%>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8" %>
<%@ page import="me.yobol.greentable.commons.path.*" %>

<link rel="stylesheet" type="text/css" href="<%=CPath.cMain(request) %>"/>
<%
	int n = 4;
	List<IngredientBean> igs = IngredientService.getFirstNIgsByScans(n);
	List<DishesBean> ds = DishesService.getFirstNDsByScans(n);
%>
<div id="main_outer">
	<div style="width:100%;height:60px;">用来辅助布局——代替header脱离文档流后在页面上的空缺——删掉我就GG</div>
	<div id="main" class="w_1000">
		<div id="dp_list">
			<div id="dp_list_top">
				<h4>食材</h4>
				<a href="<%=SPath.sGetIngredientList(request, "?flag=0")%>">更多食材</a>
			</div>
			<div id="dp_item_outer">
			<%
				for(int i = 0;i < igs.size();i++){
			%>
				<div id="dp_item">
					<a href="<%=SPath.sGetIngredient(request, "?ingredientId=" + igs.get(i).getIngredientId())%>"><img class="dp_item_img" src="<%=igs.get(i).getIngredientImg() %>"/></a>
					<div id="dp_item_bottom">
						<h5><%=igs.get(i).getIngredientName() %></h5>
						<p>
							<span class="dp_item_comment"><%=igs.get(i).getIngredientCommentCtr() %>&nbsp;评论&nbsp;</span>
							<span class="dp_item_scans"><%=igs.get(i).getIngredientScansCtr() %>&nbsp;人气&nbsp;</span>
						</p>
						<p><span class="dp_item_author"><%=UserService.getUNameByUID(igs.get(i).getTraderId()) %></span></p>
					</div>
				</div>
			<%
				}
			%>
			</div>
		</div>
		
		
		<div id="dp_list">
			<div id="dp_list_top">
				<h4>菜谱</h4>
				<a href="<%=SPath.sGetDishesList(request, "?flag=0")%>">更多菜谱</a>
			</div>
			<div id="dp_item_outer">
			<%
				for(int i = 0;i < ds.size();i++){
			%>
				<div id="dp_item">
					<a href="<%=SPath.sGetDishes(request, "?dishesId=" + ds.get(i).getDishesId())%>"><img class="dp_item_img" src="<%=RPath.getImgUrl(request, "d" + i + ".jpg") %>"/></a>
					<div id="dp_item_bottom">
						<h5><%=ds.get(i).getDishesName() %></h5>
						<p>
							<span class="dp_item_comment"><%=ds.get(i).getDishesCommentCtr() %>&nbsp;评论&nbsp;</span>
							<span class="dp_item_scans"><%=ds.get(i).getDishesScansCtr() %>&nbsp;人气&nbsp;</span>
						</p>
						<p><span class="dp_item_author"><%=UserService.getUNameByUID(ds.get(i).getDishesOwner()) %></span></p>
					</div>
				</div>
			<%
				}
			%>
			</div>
		</div>
	</div>
</div>